package com.example.treasure_back.controller;

import com.example.treasure_back.entity.MsgEntity;
import com.example.treasure_back.model.ChatroomModel;
import com.example.treasure_back.service.ChatroomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/treasure/chatroom")
public class ChatroomController {
    @Autowired
    private ChatroomService chatroomService;

    @RequestMapping("/getChatrooms")
    public MsgEntity getChatrooms(){
        List<ChatroomModel> chatroomList = chatroomService.getChatroomList();
        return new MsgEntity("SUCCESS","200",chatroomList);
    }

}
